//
//  MoreViewController.m
//  SIPphone
//
//  Created by wrt on 13-10-25.
//  Copyright (c) 2013年 wrtsoft. All rights reserved.
//  

#import "MoreViewController.h"
#import "SoundMessageViewController.h"
#import "SettingViewController.h"
#import "MeViewController.h"
#import "AlarmControlViewController.h"
#import "AboutViewController.h"

@interface MoreViewController ()

@end

@implementation MoreViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = NSLocalizedString(@"more", @" 更多 tabbar Item For more name ");
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
//    self.titleArray = @[@"我",@"防区控制",@"语音留言",@"设置",@"关于"];
    self.titleArray = @[NSLocalizedString(@"Me", @"我 Me"),NSLocalizedString(@"zone Control", @"防区控制 Zone Controlend"),NSLocalizedString(@"setting", @"设置 Setting"),NSLocalizedString(@"about", @"关于 About")];
}

- (void)viewWillAppear:(BOOL)animated
{
    [self.tableView reloadData];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//    return 5;
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"moreIdentifer";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        cell.textLabel.text = self.titleArray[indexPath.row];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    
    
    if (indexPath.row == 0)
    {
        cell.imageView.image = [UIImage imageNamed:@"my_account.png"];
    }
    else if (indexPath.row == 1)
    {
        cell.imageView.image = [UIImage imageNamed:@"fangqukongzhi.png"];
    }
//    else if (indexPath.row == 2)
//    {
//        cell.imageView.image = [UIImage imageNamed:@"comment.png"];
//    }
    else if (indexPath.row == 2)
    {
        cell.imageView.image = [UIImage imageNamed:@"settings11.png"];
    }
    else if (indexPath.row == 3)
    {
        cell.imageView.image = [UIImage imageNamed:@"star.png"];
    }
    
    
    
    return cell;
}

#pragma mark - Table view delegate
//分别选择哪个按钮会跳转到对应的界面上
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSUInteger row=indexPath.row;
    if (row == 0)
    {
        MeViewController *meVC = [[MeViewController alloc] init];
        [meVC setHidesBottomBarWhenPushed:YES];
        [self.navigationController pushViewController:meVC animated:YES];
    }else if (row == 1)
    {
        AlarmControlViewController *alarmVC = [[AlarmControlViewController alloc] init];
        [alarmVC setHidesBottomBarWhenPushed:YES];
        [self.navigationController pushViewController:alarmVC animated:YES];
    }
//    else if (row == 2)
//    {
//        SoundMessageViewController *smVC = [[SoundMessageViewController alloc] init];
//        [self.navigationController pushViewController:smVC animated:YES];
//    }
    else if (row == 2)
    {
        SettingViewController *setVC = [[SettingViewController alloc] init];
        [setVC setHidesBottomBarWhenPushed:YES];
        [self.navigationController pushViewController:setVC animated:YES];
    }
    else if (row == 3)
    {
        AboutViewController *aboutVC = [[AboutViewController alloc] init];
        [aboutVC setHidesBottomBarWhenPushed:YES];
        [self.navigationController pushViewController:aboutVC animated:YES];
    }
}

@end
